cmake_minimum_required(VERSION 3.16)

project(t1 VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.4 REQUIRED COMPONENTS Quick QuickControls2)

qt_standard_project_setup()

set(app_icon_resource_windows "${CMAKE_CURRENT_SOURCE_DIR}/resources/photosurface.rc")

qt_add_resources(RESOURCE_FILE rs.qrc)

qt_add_executable(HiChat
    main.cpp
    ${app_icon_resource_windows}
    ${RESOURCE_FILE}
)

qt_add_qml_module(HiChat
    URI t1
    VERSION 1.0
    QML_FILES
        Main.qml
        QML_FILES HButton.qml
        QML_FILES HTabButton.qml
        QML_FILES HTitleBar.qml
        QML_FILES HWindow.qml
        QML_FILES MainPanel.qml
        QML_FILES HMoveableBar.qml
        QML_FILES HSearchBar.qml
        QML_FILES MainPanelButton.qml
        QML_FILES Level2Panel.qml
        QML_FILES HSearchBar2.qml
        QML_FILES ChatMessageModel.qml
        QML_FILES ContactItemLabel.qml
        RESOURCES rs.qrc
        QML_FILES Avatar.qml
        QML_FILES Level3Panel.qml
        QML_FILES Panel2Menu.qml
        QML_FILES RedPoint.qml
        QML_FILES ChatMessageItem.qml
        QML_FILES ChatMessageBox.qml
        QML_FILES ChatMessageListModel.qml
        QML_FILES EmojiFrame.qml
        QML_FILES EmojiModel.qml
)


set_target_properties(HiChat PROPERTIES
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(HiChat
    PRIVATE Qt6::Quick Qt6::QuickControls2
)

include(GNUInstallDirs)
install(TARGETS HiChat
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
add_subdirectory(OpenImWapper)
